Developer Documentation

QuickTime 4 API Documentation

Inside Macintosh: Files

Previous | Chapter Top | Chapter Contents | Next |

Manipulating the End-of-File

You can use the functions GetEOF and SetEOF to get or set the logical end-of-file of an open file.

GetEOF

You can use the GetEOF function to determine the current logical end-of-file of an open file.

FUNCTION GetEOF (refNum: Integer; VAR logEOF: LongInt): OSErr;
refNum
The file reference number of an open file.
logEOF
On output, the logical end-of-file.

DESCRIPTION

The GetEOF function returns, in the logEOF parameter, the logical end-of-file of the specified file.

RESULT CODES

noErr

0

No error

ioErr

-36

I/O error

fnOpnErr

-38

File not open

rfNumErr

-51

Bad reference number

afpAccessDenied

-5000

User does not have the correct access to the file

SEE ALSO

For a description of the logical and physical end-of-file, see the section "File Access Characteristics" .

SetEOF

You can use the SetEOF function to set the logical end-of-file of an open file.

FUNCTION SetEOF (refNum: Integer; logEOF: LongInt): OSErr;
refNum
The file reference number of an open file.
logEOF
The logical end-of-file.

DESCRIPTION

The SetEOF function sets the logical end-of-file of the specified file. If you attempt to set the logical end-of-file beyond the physical end-of-file, the physical end-of-file is set 1 byte beyond the end of the next free allocation block; if there isn't enough space on the volume, no change is made, and SetEOF returns dskFulErr as its function result.

If you set the logEOF parameter to 0, all space occupied by the file on the volume is released. The file still exists, but it contains 0 bytes. Setting a file fork's end-of-file to 0 is therefore not the same as deleting the file (which removes both file forks at once).

RESULT CODES

noErr

0

No error

dskFulErr

-34

Disk full

ioErr

-36

I/O error

fnOpnErr

-38

File not open

wPrErr

-44

Hardware volume lock

fLckdErr

-45

File is locked

vLckdErr

-46

Software volume lock

rfNumErr

-51

Bad reference number

wrPermErr

-61

Read/write permission doesn't allow writing

SEE ALSO

For a description of the logical and physical end-of-file, see the section "File Access Characteristics" .


© 1997 Apple Computer, Inc.

Previous | Chapter Top | Chapter Contents | Next